/*
 * @Author: cl
 * @Description: 
 * @Date: 2023-05-05 11:07:24
 * @LastEditTime: 2023-05-05 17:03:08
 * @FilePath: \jsnode\nestjs\naota\src\upload\upload.controller.ts
 * @LastEditors: cl
 */
import { Controller, Post, UploadedFile, UseInterceptors } from '@nestjs/common';
import { FileFilter, fileType } from './upload.detorator';
import { UploadService } from './upload.service';
import { UploadInterceptor } from './uploadInterceptor';

@Controller('upload')
@UseInterceptors(new UploadInterceptor())
export class UploadController {
  constructor(private readonly uploadService: UploadService) {}

  @Post('image')
  @FileFilter('myfile',{
    limits:{fileSize:1024*1024},
    fileFilter:fileType(['image','pdf'])
  })
  upload(@UploadedFile() file: Express.Multer.File) {
    return file
  }
}
